package cn.edu.lingnan.servlet;

import java.io.IOException;
import java.util.Vector;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import cn.edu.lingnan.dao.CourseDao;
import cn.edu.lingnan.dao.StudentDao;
import cn.edu.lingnan.dto.CourseDto;
import cn.edu.lingnan.dto.StudentDto;

@WebServlet("/admin/findAllCourse")
public class CourseFindAllServlet extends HttpServlet {
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		//1
		//2
		CourseDao sd=new CourseDao();
		Vector<CourseDto> v=sd.findAllCourse();
		HttpSession session=req.getSession();
		session.setAttribute("allCourse",v);
		//3
		resp.sendRedirect(req.getContextPath()+"/admin/allCourse.jsp");
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doGet(req, resp);
	}
}
